<html>
<head>
  <title>HTTP JSON Client Test</title>
  <script type="text/javascript">
    function sendMessage() {
      var xmlhttp = new XMLHttpRequest();
      xmlhttp.open('POST', "", true);
      
      // Manage the response
      xmlhttp.onreadystatechange = function () {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
          var response = JSON.parse(xmlhttp.response);
          if (response[0] == "onReception") alert(response[1]);
        }
      }
      // Send the POST request
      xmlhttp.setRequestHeader('Content-Type', 'application/json');
      var data = ["onMethod", "http json msg"];
      xmlhttp.send(JSON.stringify(data));
    }
  </script>
</head>
<body>
    <input type="button" value="Send" onclick="sendMessage();" />
</body>
</html>